//api文件夹用于存放对后台请求的代码
import service from ".";//导入

const collectApi = {
    //收藏
    insert(goodsId){
        return service.post(`/collect/${goodsId}`);
    },
    //取消收藏
    delete(id) {
        return service.delete(`/collect/${id}`);
    },
    //根据商品id和用户id查询
    selectByGoodsIdAndUserId(goodsId){
        return service.get(`/collect/${goodsId}`);
    },
    //分页搜索
    selectByPage(condition, pageNum, pageSize) {
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/collect", {
            params: condition
        });
    },
    //根据id查询
    selectById(id) {
        return service.get(`/collect/${id}`);
    },
};

export default collectApi;//导出